package com.heima.behavior.controller;

import com.heima.behavior.service.UnLikeBehaviorServiceImpl;
import com.heima.model.behavior.dtos.LikeBehaviorDto;
import com.heima.model.behavior.dtos.ReadBehaviorDto;
import com.heima.model.common.dtos.ResponseResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author 许敦军
 * @version 1.0
 * @project heima-leadnews
 * @date 2024/1/24 22:51:38
 */
@RestController
@RequestMapping("/api/v1")
public class LikeBehaviorController {
    @Autowired
    private UnLikeBehaviorServiceImpl likeBehaviorService;

    /**
     * 不喜欢行为
     *
     * @param likeBehaviorDto 喜欢行为dto
     * @return {@link ResponseResult}
     */
    @PostMapping("/un_likes_behavior")
    public ResponseResult unLikeBehavior(@RequestBody LikeBehaviorDto likeBehaviorDto){
        return likeBehaviorService.unLikeBehavior(likeBehaviorDto);
    }


    /**
     * 喜欢行为
     *
     * @return {@link ResponseResult}
     */
    @PostMapping("/likes_behavior")
    public ResponseResult LikesBehavior(@RequestBody LikeBehaviorDto likeBehaviorDto){
        return likeBehaviorService.LikesBehavior(likeBehaviorDto);

    }

    /**
     * 读取行为
     *
     * @param readBehaviorDto 读取行为dto
     * @return {@link ResponseResult}
     */
    @PostMapping("/read_behavior")
    public ResponseResult readBehavior(@RequestBody ReadBehaviorDto readBehaviorDto){
        return likeBehaviorService.readBehavior(readBehaviorDto);

    }


}
